package com.example.springboot.rest;

import com.example.helloserviceapi.model.User;
import com.example.helloserviceapi.service.HelloService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by yxw on 2017/10/5.
 */
@RestController
public class RefactorHelloController implements HelloService {
    /*@Override
    public String hello() {
        return "Hello Word";
    }*/

    @Override
    public String hello(@RequestParam String name) {
        return "Hello" + name;
    }

    @Override
    public User hello(@RequestHeader("name") String name, @RequestHeader("age") Integer age) {
        return new User(name, age);
    }

    @Override
    public String hello(@RequestBody User user) {
        return "Hello" + user.getName() + ", " + user.getAge();
    }

}
